package day0302;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

public class Demo06 {

    public static void main(String[] args) {
        // Date --> LocalDateTime
//        Date date = new Date();
//        // 瞬间
//        Instant instant = date.toInstant();
//        // 添加时区信息
//        ZonedDateTime zonedDateTime = instant.atZone(ZoneId.systemDefault());
//
//        LocalDateTime localDateTime = zonedDateTime.toLocalDateTime();
//
//        System.out.println(localDateTime);


        // LocalDateTime  --> Date
        LocalDateTime localDateTime = LocalDateTime.of(2008, 8, 8, 12, 00, 01);

        ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());

        Instant instant = zonedDateTime.toInstant();

        Date from = Date.from(instant);

        System.out.println(from);

    }
}
